﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Net.Chirash.Twitter.TwitterClient
{
    public class DirectMessageOption
    {
        #region Public Properties

        public long SinceID { get; set; }

        public long MaxID { get; set; }

        public int Count { get; set; }

        public int Page { get; set; }

        #endregion

        #region Public Methods

        public override string ToString()
        {
            string result = "";
            if (SinceID > 0 && MaxID > 0 && Count > 0 && Page > 0)
            {
                result = "";
            }
            else
            {
                result = "?";
                if (SinceID > 0)
                {
                    result += string.Format("since_id={0}&", SinceID);
                }
                if (MaxID > 0)
                {
                    result += string.Format("max_id={0}&", MaxID);
                }
                if (Count > 0)
                {
                    result += string.Format("count={0}&", Math.Min(Count, MaxCount));
                }
                if (Page > 0)
                {
                    result += string.Format("page={0}&", Page);
                }
                if (result.EndsWith("&"))
                {
                    result = result.Substring(0, result.Length - 1);
                }
            }
            return result;
        }

        #endregion

        #region Private Fields

        int MaxCount = 200;

        #endregion
    }
}
